package com.example.Laboratory.Service.Impl;

import com.example.Laboratory.Entity.Contact;
import com.example.Laboratory.Mapper.ContactMapper;
import com.example.Laboratory.Service.ContactService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ContactServiceImpl implements ContactService {

    @Autowired
    ContactMapper contactMapper;

    //添加友情链接
    @Override
    public String addContact(Contact t) {
        if (contactMapper.addContact(t) == 1) {
            return "添加成功";
        } else {
            return "添加失败";
        }
    }

    //查找友情链接
    @Override
    public List<Contact> selectContact() {
        return contactMapper.selectContact();
    }

    //删除友情链接
    @Override
    public String deleteContact(int contact_id) {
        if (contactMapper.deleteContact(contact_id) == 1) {
            return "删除成功";
        } else {
            return "删除失败";
        }
    }

    //修改友情链接
    @Override
    public String updateContact(Contact i) {
        if (contactMapper.updateContact(i) == 1) {
            return "修改成功";
        } else {
            return "修改失败";
        }
    }
}
